FROM frolvlad/alpine-glibc:alpine-3.20 AS jre
ADD jre-8u421-linux-x64.tar.gz /
RUN cd /jre1.8.0_421 \
    && rm -rf COPYRIGHT LICENSE README release THIRDPARTYLICENSEREADME-JAVAFX.txt THIRDPARTYLICENSEREADME.txt Welcome.html \
    && rm -rf lib/plugin.jar \
           lib/ext/jfxrt.jar \
           bin/javaws \
           lib/javaws.jar \
           lib/desktop \
           plugin \
           lib/deploy* \
           lib/*javafx* \
           lib/*jfx* \
           lib/amd64/libdecora_sse.so \
           lib/amd64/libprism_*.so \
           lib/amd64/libfxplugins.so \
           lib/amd64/libglass.so \
           lib/amd64/libgstreamer-lite.so \
           lib/amd64/libjavafx*.so \
           lib/amd64/libjfx*.so

FROM frolvlad/alpine-glibc:alpine-3.20
ENV TZ Asia/Shanghai
COPY --from=jre /jre1.8.0_421 /jre1.8.0_421
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories \
    && apk add tzdata curl \
    && cp /usr/share/zoneinfo/${TZ} /etc/localtime \
    && echo ${TZ} > /etc/timezone \
    && rm -rf /var/cache/apk
ENV JAVA_HOME=/jre1.8.0_421
ENV PATH=$JAVA_HOME/bin:$PATH
EXPOSE 80 8080